package com.ptp.backendcertms.api.internal.exception;

import com.ptp.backendcertms.api.internal.constant.SystemResponseEnum;
import lombok.Getter;
import lombok.Setter;


@Setter
@Getter
public class SystemException extends RuntimeException {

    /**
     * 异常编码
     */
    private String errorCode;
    /**
     * 异常信息
     */
    private String errorMsg;
    /**
     * 打印堆栈
     */
    private Boolean printStack;

    public SystemException(String errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
        this.printStack = true;
    }

    public SystemException(SystemResponseEnum systemResponseEnum) {
        super(systemResponseEnum.getMessage());
        this.errorCode = systemResponseEnum.name();
        this.errorMsg = systemResponseEnum.getMessage();
        this.printStack = systemResponseEnum.getPrintStack();
    }


}
